class Solution {
public:
    vector<string> res;
    
    vector<string> letterCasePermutation(string s) {
        int n=s.size();
        backtrack(s,"",0,n);
        return res;
    }

    void backtrack(string s,string path,int i,int n){
        if(i==n){res.push_back(path);return;}   
        // 数字直接添加
        if(s[i]>='0'&&s[i]<='9')backtrack(s,path+s[i],i+1,n);
        else{
          
            backtrack(s,path+s[i],i+1,n);
            backtrack(s,path+char(s[i]^32),i+1,n);
        }
    }
};
``
